/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.util;

import java.util.Vector;

/**
 *
 * @author Marnix Renne
 */
public class Stack {
    private Vector stack;
    
    public Stack() {
        stack = new Vector();
    }
    
    public Object top() {
        if(stack.size() > 0) {
            return stack.lastElement();
        }
        return null;
    }
    
    public void push(Object o) {
        stack.addElement(o);
    }
    
    public Object pop() {
        Object result = this.top();
        stack.removeElementAt(stack.size()-1);
        return result;
    }
    
    public int size() {
        return stack.size();
    }
}
